<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Insert title here</title>
  <link rel="stylesheet" href="__PUBLIC__/css/wxjsdemo.css">
  <meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=0">
<script src="http://res.wx.qq.com/open/js/jweixin-1.0.0.js"></script>
        <script>
            wx.config({
            	debug:true,//debug 调试 弹出框
            	appId: '{$signPackage.appId}',
                timestamp: {$signPackage.timestamp},
                nonceStr: '{$signPackage.nonceStr}',
                signature: '{$signPackage.signature}',
               jsApiList: [
                           'checkJsApi',
                           'onMenuShareTimeline',
                           'onMenuShareAppMessage',
                           'onMenuShareQQ',
                           'onMenuShareWeibo',
                           'onMenuShareQZone',
                           'hideMenuItems',
                           'showMenuItems',
                           'hideAllNonBaseMenuItem',
                           'showAllNonBaseMenuItem',
                           'translateVoice',
                           'startRecord',
                           'stopRecord',
                           'onVoiceRecordEnd',
                           'playVoice',
                           'onVoicePlayEnd',
                           'pauseVoice',
                           'stopVoice',
                           'uploadVoice',
                           'downloadVoice',
                           'chooseImage',
                           'previewImage',
                           'uploadImage',
                           'downloadImage',
                           'getNetworkType',
                           'openLocation',
                           'getLocation',
                           'hideOptionMenu',
                           'showOptionMenu',
                           'closeWindow',
                           'scanQRCode',
                           'chooseWXPay',
                           'openProductSpecificView',
                           'addCard',
                           'chooseCard',
                           'openCard'
                  ]
              }); 
            //config验证成功
            wx.ready(function () {
                  // 1 判断当前版本是否支持指定 JS 接口，支持批量判断
                wx.checkJsApi({
                  jsApiList: [
                              'checkJsApi',
                              'onMenuShareTimeline',
                              'onMenuShareAppMessage',
                              'onMenuShareQQ',
                              'onMenuShareWeibo',
                              'onMenuShareQZone',
                              'hideMenuItems',
                              'showMenuItems',
                              'hideAllNonBaseMenuItem',
                              'showAllNonBaseMenuItem',
                              'translateVoice',
                              'startRecord',
                              'stopRecord',
                              'onVoiceRecordEnd',
                              'playVoice',
                              'onVoicePlayEnd',
                              'pauseVoice',
                              'stopVoice',
                              'uploadVoice',
                              'downloadVoice',
                              'chooseImage',
                              'previewImage',
                              'uploadImage',
                              'downloadImage',
                              'getNetworkType',
                              'openLocation',
                              'getLocation',
                              'hideOptionMenu',
                              'showOptionMenu',
                              'closeWindow',
                              'scanQRCode',
                              'chooseWXPay',
                              'openProductSpecificView',
                              'addCard',
                              'chooseCard',
                              'openCard'
                  ], 
                  success:function(res){
                	 // alert('chenggong');
                  }
                });
            });
            //config验证失败
            wx.error(function(res){
            	aler('config 验证失败');
            	aler(res);
            });
             //点击事件监听   
                function test(){
                	alert('点击按钮');
                  	wx.getNetworkType({
                  	    success: function (res) {
                  	        var networkType = res.networkType; // 返回网络类型2g，3g，4g，wifi
                  	        alert(networkType);
                  	    }
                  	});
                }
                function scan(){
                	 wx.scanQRCode();
                }
                function dscan(){
                	 wx.scanQRCode({
                	      needResult: 1,
                	      desc: 'scanQRCode desc',
                	      success: function (res) {
                	        alert(JSON.stringify(res));
                	      }
                	    });
                }
        </script>
        
</head>
<body>
<button class="btn btn_primary" id="scanQRCode0" onclick = "scan()">scanQRCode(微信处理结果)</button>
<button class="btn btn_primary" id="scanQRCode1" onclick = "dscan()">scanQRCode(直接返回结果)</button>
<button class="btn btn_primary" id="scanQRCode3" onclick = "test()">网络状态</button>
</body>
</html>